package com.message.Aliyun_ai_API.Enum;

public enum TexttoImageStyle {
    auto(1, "<auto>"),
    photography(2, "<photography>"),
    portrait(3, "<portrait>"),
    cartoon(4, "<3d cartoon>"),
    anime(5, "<anime>"),
    oil_painting(6, "<oil painting>"),
    watercolor(7, "<watercolor>"),
    sketch(8, "<sketch>"),
    chinese_painting(9, "<chinese painting>"),
    flat_illustration(10, "<flat illustration>");

    private final int styleCode;
    private final String styleName;

    TexttoImageStyle(int styleCode, String styleName) {
        this.styleCode = styleCode;
        this.styleName = styleName;
    }

    public int getStyleCode() {
        return styleCode;
    }

    public String getStyleName() {
        return styleName;
    }

    // 从整数获取枚举值
    public static TexttoImageStyle fromStyleCode(int styleCode) {
        for (TexttoImageStyle style : values()) {
            if (style.getStyleCode() == styleCode) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style code: " + styleCode);
    }

    // 从字符串获取枚举值
    public static TexttoImageStyle fromStyleName(String styleName) {
        for (TexttoImageStyle style : values()) {
            if (style.getStyleName().equalsIgnoreCase(styleName)) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style name: " + styleName);
    }
}